﻿jQuery(document).ready(function () {

    jQuery(".memberlogin").focusout(function () {

        var ctrl = jQuery(this);
        var login = ctrl.val();

        if (login != "") {
            jQuery.ajax({
                type: "POST",
                url: "/umbraco/plugins/ContourStrikesAgain/members.asmx/IsUniqueLogin",
                data: "{login: '" + login + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (msg) {

                    if (msg.d == true) {

                    } else {
                        alert('username already in use');
                        ctrl.val("");
                    }
                }
            });
        }

    });

})